﻿<!DOCTYPE html>
<html>

<head>
	<meta charset="UTF-8">
	<title>学校添加</title>
<link rel="stylesheet" href="/scriptZIP/layui.min.css">
	<link rel="stylesheet" href="css/common2.css">
	<link rel="stylesheet" href="css/layui.css" />
	<link rel="stylesheet" href="/scriptZIP/vue-select.min.css">
	<style>
		.layui-row {
			margin-top: 50px;
		}

		.required::before {
			content: "*";
			color: red;
			font-size: 15px;
			margin-right: 5px;
		}
	</style>
</head>

<body>

	<form class="layui-form" id="vue-root">
		<div class="layui-row">
			<div class="layui-col-md6 layui-col-md-offset3">
				<div class="layui-form-item">
					<label class="layui-form-label">代理商</label>
					<div class="layui-input-block">
						<select name="agent" v-validate="'required'" class="layui-input school" v-model="item.agentId">
							<option :value="undefined" disabled="disabled">请选择代理商</option>
							<option v-for="(agent,index) in agents" v-text="agent.name" :key="agent.id"
								:value="agent.id"></option>
						</select>
						<div class="checkout_state" v-text="err('agent')">
						</div>
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">合作人名称</label>
					<div class="layui-input-block">
						<input name="linkman" autocomplete="off" placeholder="请输入合作人名称" class="layui-input telname"
							v-model="item.linkman">
						<div class="checkout_state" v-text="err('linkman')"></div>
					</div>
					<div class="layui-form-item">
						<label class="layui-form-label">合作人身份证号</label>
						<div class="layui-input-block">
							<input name="identity" autocomplete="off" placeholder="请输入合作人身份证号"
								class="layui-input telname" v-model="item.identity">
							<div class="checkout_state" v-text="err('identity')"></div>
						</div>
						<div class="layui-form-item">
							<label class="layui-form-label">合作校区名称</label>
							<div class="layui-input-block">
								<input name="schoolName" v-validate="'required'" autocomplete="off"
									placeholder="请输入合作校区名称" class="layui-input name" v-model="item.name">
								<div class="checkout_state" v-text="err('schoolName')"></div>
							</div>
						</div>
						<div class="layui-form-item">
							<label class="layui-form-label">联系方式</label>
							<div class="layui-input-block">
								<input name="contactInfo" autocomplete="off" placeholder="请输入联系方式"
									class="layui-input tel" v-model="item.contactInfo">
								<div class="checkout_state" v-text="err('contactInfo')"></div>
							</div>
						</div>

						<div class="layui-form-item">
							<label class="layui-form-label">省份</label>
							<div class="layui-input-block">
								<select class="layui-input" v-model="province" @select="city=''">
									<option value="" style="padding-bottom:200px">请选择省份</option>
									<option v-for="(p,id) in provinces" v-text="p" :key="id" :value="id"></option>
								</select>
							</div>
						</div>

						<div class="layui-form-item">
							<label class="layui-form-label">城市</label>
							<div class="layui-input-block">
								<select v-model="city" class="layui-input" @select="area=''">
									<option value="">请选择城市</option>
									<option v-for="(c,id) in cities" v-text="c" :key="id" :value="id"></option>
								</select>
							</div>
						</div>

						<div class="layui-form-item">
							<label class="layui-form-label">区域</label>
							<div class="layui-input-block">
								<select v-model="area" class="layui-input">
									<option value="">请选择区域</option>
									<option v-for="(a,id) in areas" v-text="a" :key="id" :value="id"></option>
								</select>
							</div>
						</div>
						<div class="layui-form-item">
							<label class="layui-form-label">详细地址</label>
							<div class="layui-input-block">
								<input name="schoolAddress" autocomplete="off" placeholder="请输入详细地址"
									class="layui-input address" v-model="item.address">
								<div class="checkout_state" v-text="err('schoolAddress')"></div>
							</div>
						</div>

						<div class="layui-form-item">
							<label class="layui-form-label">学校类型</label>
							<div class="layui-input-block">
								<select class="layui-input" v-model="item.type1">
									<option :value="undefined">请选择学校类型</option>
									<option :value="0">幼儿园</option>
									<option :value="1">小学</option>
									<option :value="2">中学</option>
									<option :value="3">培训机构</option>
									<option :value="4">其他</option>
								</select>
							</div>
						</div><br />
					</div>
					<div class="layui-form-item">
						<label class="layui-form-label">目标学校</label>
						<div class="layui-input-block">
							<input name="targetSchool" autocomplete="off" placeholder="请输入目标学校"
								class="layui-input address" v-model="item.targetSchool">
							<div class="checkout_state" v-text="err('targetSchool')"></div>
						</div>
					</div>
					<div class="layui-form-item">
						<label class="layui-form-label">合同编号</label>
						<div class="layui-input-block">
							<input type="file" id="File1" name="file" accept=".pdf" @change="upload" ref="file">
						</div>
					</div>
					<!-- <div class="layui-form-item">
						<label class="layui-form-label">管理专员</label>
						<div class="layui-input-block">
							<input name="schoolAddress" autocomplete="off" placeholder="请输入详细地址"
								class="layui-input address" v-model="item.address">
							<div class="checkout_state" v-text="err('schoolAddress')"></div>
						</div>
					</div>
					<div class="layui-form-item">
						<label class="layui-form-label">选址人员</label>
						<div class="layui-input-block">
							<input name="schoolAddress" autocomplete="off" placeholder="请输入详细地址"
								class="layui-input address" v-model="item.address">
							<div class="checkout_state" v-text="err('schoolAddress')"></div>
						</div>
					</div> -->
					<div class="layui-form-item">
						<label class="layui-form-label">首次签约时间</label>
						<div class="layui-input-block">
							<input type="text" class="layui-input" id="startTime" v-model="item.startTime" placeholder="选择时间">
						</div>
					</div>
					
					<div class="layui-form-item">
						<label class="layui-form-label">开业时间</label>
						<div class="layui-input-block">
							<input type="text" class="layui-input" id="openingTime" v-model="item.openingTime" placeholder="选择时间">
						</div>
					</div>
					
					<div class="layui-form-item">
						<label class="layui-form-label">合同到期时间</label>
						<div class="layui-input-block">
							<input type="text" class="layui-input" id="expiryDate" v-model="item.expiryDate" placeholder="选择时间">
						</div>
					</div>
					
					<div class="layui-form-item">
						<label class="layui-form-label">下次续约时间</label>
						<div class="layui-input-block">
							<input type="text" class="layui-input" id="renewalTime" v-model="item.renewalTime" placeholder="选择时间">
						</div>
					</div>

					<div class="layui-form-item">
						<label class="layui-form-label required">校区状态</label>
						<div class="layui-input-block">
							<!-- 使用固定的校区状态值 -->
							<select v-model="item.campusStatus" class="select_vue">
								<option value="1">未选址</option>
								<option value="2">已选址未成功</option>
								<option value="3">已选址未装修</option>
								<option value="4">装修中</option>
								<option value="5">试营业中</option>
								<option value="6">已开业</option>
								<option value="7">已停业</option>
								<option value="8">已退款</option>
								<option value="9">已解约</option>
								<option value="10">待维权</option>
								<!-- 添加更多的选项根据您的需求 -->
							</select>
							<!-- 错误提示信息 -->
							<div class="checkout_state" v-text="err('campusStatus')"></div>
						</div>
					</div>

					<div class="layui-form-item">
						<label class="layui-form-label">培训报名赠送次数</label>
						<div class="layui-input-block">
							<input name="training" autocomplete="off" placeholder="请输入次数" class="layui-input address"
								v-model="item.training">
							<div class="checkout_state" v-text="err('training')"></div>
						</div>
					</div>

					<!-- <div class="layui-form-item">
						<label class="layui-form-label">招商人员</label>
						<div class="layui-input-block">
							<input name="schoolAddress" autocomplete="off" placeholder="请输入招商人员"
								class="layui-input address" v-model="item.address">
							<div class="checkout_state" v-text="err('schoolAddress')"></div>
						</div>
					</div> -->

					<div class="layui-form-item">
						<label class="layui-form-label">签单人员</label>
						<div class="layui-input-block">
							<input name="personnelAccount" autocomplete="off" placeholder="请输入签单人员"
								class="layui-input address" v-model="item.personnelAccount">
							<div class="checkout_state" v-text="err('personnelAccount')"></div>
						</div>
					</div>


					<div class="layui-form-item">
						<label class="layui-form-label">学校账号</label>
						<div class="layui-input-block">
							<input name="username" v-validate="'required'" placeholder="请输入学校账号"
								class="layui-input username" v-model="item.username">
							<div class="checkout_state" v-text="err('username')"></div>
						</div>
					</div>
					<div class="layui-form-item">
						<label class="layui-form-label">密码</label>
						<div class="layui-input-block">
							<input name="password" placeholder="请输入密码" class="layui-input password" type="text"
								v-model="item.password">
							<div class="checkout_state" v-text="err('password')"></div>
						</div>
					</div>

					<div class="layui-form-item">
						<label class="layui-form-label">到期时间</label>
						<div class="layui-input-block">
							<input type="text" class="layui-input" id="test3" v-model="item.expiryDate"
								placeholder="请输入结束时间">
						</div>
					</div>

				

					<!-- <div class="layui-form-item">
						<label class="layui-form-label">班级圈视频数量</label>
						<div class="layui-input-block">
							<input type="number" class="checkbox layui-input" v-model="item.circle" />
						</div>
					</div> -->

					<div class="layui-form-item">
						<label class="layui-form-label required">公众号</label>
						<div class="layui-input-block">
							<v-select name="wechatPlatform" v-validate="'required'" placeholder="请选择公众号" label="name"
								:options="platforms" class="select_vue" :reduce="item=>item.id"
								v-model="item.wechatPlatformId"></v-select>
							<div class="checkout_state" v-text="err('wechatPlatform')"></div>
						</div>
					</div>
					
					<div class="layui-form-item">
						<label class="layui-form-label">扫呗商户号</label>
						<div class="layui-input-block">
							<input name="merchantNo" autocomplete="off" placeholder="请输入扫呗商户号"
								class="layui-input address" v-model="item.merchantNo">
							<div class="checkout_state" v-text="err('merchantNo')"></div>
						</div>
					</div>

					<div class="layui-form-item">
						<label class="layui-form-label">扫呗终端号</label>
						<div class="layui-input-block">
							<input name="terminalId" autocomplete="off" placeholder="请输入扫呗终端号"
								class="layui-input address" v-model="item.terminalId">
							<div class="checkout_state" v-text="err('terminalId')"></div>
						</div>
					</div>

					<div class="layui-form-item">
						<label class="layui-form-label">扫呗秘钥</label>
						<div class="layui-input-block">
							<input name="accessToken" autocomplete="off" placeholder="请输入扫呗秘钥"
								class="layui-input address" v-model="item.accessToken">
							<div class="checkout_state" v-text="err('accessToken')"></div>
						</div>
					</div>

					<!-- <div class="layui-form-item">
						<label class="layui-form-label">建设银行商户号</label>
						<div class="layui-input-block">
							<input name="accessToken" autocomplete="off" placeholder="请输入建设银行商户号"
								class="layui-input address" v-model="item.jhMerchantNo">
							<div class="checkout_state" v-text="err('accessToken')"></div>
						</div>
					</div>

					<div class="layui-form-item">
						<label class="layui-form-label">建设银行商户柜台代码</label>
						<div class="layui-input-block">
							<input name="accessToken" autocomplete="off" placeholder="请输入建设银行商户柜台代码"
								class="layui-input address" v-model="item.posId">
							<div class="checkout_state" v-text="err('accessToken')"></div>
						</div>
					</div>

					<div class="layui-form-item">
						<label class="layui-form-label">建设银行分行号</label>
						<div class="layui-input-block">
							<input name="accessToken" autocomplete="off" placeholder="请输入建设银行分行号"
								class="layui-input address" v-model="item.branchId">
							<div class="checkout_state" v-text="err('accessToken')"></div>
						</div>
					</div>

					<div class="layui-form-item">
						<label class="layui-form-label">建设银行公钥</label>
						<div class="layui-input-block">
							<input name="accessToken" autocomplete="off" placeholder="请输入建设银行公钥"
								class="layui-input address" v-model="item.pubKey">
							<div class="checkout_state" v-text="err('accessToken')"></div>
						</div>
					</div>
					
					<div class="layui-form-item">
						<label class="layui-form-label">操作员编号</label>
						<div class="layui-input-block">
							<input name="accessToken" autocomplete="off" placeholder="请输入操作员编号"
								class="layui-input address" v-model="item.operatorNumber">
							<div class="checkout_state" v-text="err('accessToken')"></div>
						</div>
					</div>
					<div class="layui-form-item">
						<label class="layui-form-label">操作员密码</label>
						<div class="layui-input-block">
							<input name="accessToken" autocomplete="off" placeholder="请输入操作员密码"
								class="layui-input address" v-model="item.operatorPassword">
							<div class="checkout_state" v-text="err('accessToken')"></div>
						</div>
					</div> -->
					<!-- <div class="layui-form-item">
						<label class="layui-form-label">支付宝账号</label>
						<div class="layui-input-block">
							<select name="alipayId" class="layui-input publicId" v-model="item.alipayId">
								<option :value="undefined" disabled="disabled">请选择支付宝账号</option>
								<option v-for="(alipay,index) in alipays" v-text="alipay.name" :key="alipay.id"
									:value="alipay.id"></option>
							</select>
							<div class="checkout_state" v-text="err('alipayId')"></div>
						</div>
					</div> -->

					<div class="layui-form-item">
						<div class="layui-input-block">
							<div class="offer" @click="submit">立即提交</div>
							<div class="return" onclick="history.back()">取消</div>
						</div>
					</div>
				</div>
			</div>
	</form>
	<script src="/scriptZIP/qs.min.js"></script>
	<script src="/scriptZIP/vue.min.js"></script>


	<script src="/scriptZIP/axios.min.js"></script>
	<script src="/scriptZIP/vue-select.min.js"></script>
	<script src="/scriptZIP/dayjs.min.js"></script>

	<script src="/lib/laydate/laydate.js"></script>
	<script src="/js/common.js"></script>
	<script src="/js/item.js"></script>
	<script src="/js/area.js"></script>

	<script>
		Vue.component('v-select', VueSelect.VueSelect);
		var app = new Vue(mergeArea(merge({
			data: {
				agents: [],
				platforms: [],
				alipays: [],
				item: {
					agentId: null,
					wechatPlatformId: null,
					campusStatus: '1'
				},
				url: '/pc/school',
				img: '/image/upload.png'
			},
			created: function () {
				this.getAreaData();
				axios.get('/pc/agent/all').then(function (res) {
					this.agents = res.data;
				}.bind(this));
				axios.get('/pc/wechatPlatform/all').then(function (res) {
					this.platforms = res.data;
				}.bind(this));
				axios.get('/pc/alipay/all').then(function (res) {
					this.alipays = res.data;
				}.bind(this));
				this.init();
			},
			methods: {
				// submit1j: function () {
				// 	console.log(i, 11111);
				// },
				upload: function () {
					// 获取唯一的表单元素并上传文件
					var formData = new FormData(document.getElementById('vue-root'));
                axios.post('/pc/upload/pdf', formData)
                    .then((res) => {
                        this.item.file = res.data.data;
						console.log(this.item.file);
                        alert('上传成功');
                    })
                    .catch((error) => {
                        console.error('上传失败:', error);
                    });
            },
				formatData: function (data) {
					var area = data.area;
					if (!area) return;
					setTimeout(function () {
						this.province = area.province;
						this.city = area.city;
						setTimeout(function () {
							this.area = area.area;
						}.bind(this), 500);
					}.bind(this), 3000);
				},
				fillData: function () {
					this.item.area = {
						province: this.province,
						city: this.city,
						area: this.area,
						name: this.areaName()
					};
				},
			}

		})));
		laydate.render({
    elem: '#startTime',
    type: 'datetime',
    done: function (value, date, endDate) {
        app.item.startTime = value;
    }
});

laydate.render({
    elem: '#openingTime',
    type: 'datetime',
    done: function (value, date, endDate) {
        app.item.openingTime = value;
    }
});

laydate.render({
    elem: '#expiryDate',
    type: 'datetime',
    done: function (value, date, endDate) {
        app.item.expiryDate = value;
    }
});

laydate.render({
    elem: '#renewalTime',
    type: 'datetime',
    done: function (value, date, endDate) {
        app.item.renewalTime = value;
    }
});
	</script>
</body>

</html>